package com.itheima.appserver.controller;

import com.itheima.appserver.service.AdditionalService;
import com.itheima.commons.model.vo.OperationLogVo;
import com.itheima.commons.model.vo.RegistrationStayVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 额外两个接口
 */
@RestController
@RequestMapping("additional")
public class AdditionalController {

    @Autowired
    private AdditionalService additionalService;

    /**Operation log
     * 注册停留
     * @return
     */
    @GetMapping("registrationStay")
    public ResponseEntity registrationStay(@RequestParam Map<String, String> params) {
        //前端传时间区间String startTime  String endTime,性别: String gender  man或woman
        List<RegistrationStayVo> regist = additionalService.registrationStay(params);
        return ResponseEntity.ok(regist);
    }

    /**
     * 运营日志
     * @param params
     * @return
     */
    @GetMapping("operationLog")
    public ResponseEntity operationLog(@RequestParam Map<String, String> params) {
        //前端传时间区间String startTime  String endTime,
        // 操作人姓名: String adminName 操作内容 ：String operationContent;
        List<OperationLogVo> regist = additionalService.operationLog(params);
        return ResponseEntity.ok(regist);
    }
}
